﻿package {
    import org.flixel.*;

    public class StatePlay extends FlxState	{
        protected var _flames_particles_yellow:FlxEmitter;
        protected var _flames_particles_red:FlxEmitter;
        protected var _max_flame_particles:int = 20;

        override public function create():void {
            createParticles(FlxG.height, FlxG.width/2);
        }

        override public function update():void {
            super.update();
        }

        private function createParticles(X:Number, Y:Number):void {
            _flames_particles_yellow =  new FlxEmitter(X, Y);
            _flames_particles_yellow.delay = 0;
            _flames_particles_yellow.gravity = -10;
            _flames_particles_yellow.maxRotation = 0;
            _flames_particles_yellow.setYSpeed(-20, -25);
            _flames_particles_yellow.setXSpeed(-20, 20);
            
            for(var i:int = 0;i < _max_flame_particles;i++) {
                var particle:FlxSprite = new FlxSprite();
                particle.createGraphic(4, 4, 0xFFFF0000);
                _flames_particles_yellow.add(particle);
            }

            add(_flames_particles_yellow);
            _flames_particles_yellow.start(false);

            _flames_particles_red =  new FlxEmitter(X, Y);
            _flames_particles_red.delay = 0;
            _flames_particles_red.gravity = -10;
            _flames_particles_red.maxRotation = 0;
            _flames_particles_red.setYSpeed(-5, -10);
            _flames_particles_red.setXSpeed(-10, 10);
            
            for(var i:int = 0;i < _max_flame_particles;i++) {
                var particle:FlxSprite = new FlxSprite();
                particle.createGraphic(4, 4, 0xFFFFFF00);
                _flames_particles_red.add(particle);
            }

            add(_flames_particles_red);
            _flames_particles_red.start(false);

        }
    }
}
